package com.smart.tools;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

/**
 * 读取配置文件
 * @author tangyan
 *
 */
public class PropertiesUtil {

public static String getProperties(String key){
		
		Properties pro = new Properties();
		FileInputStream in = null;
		try {
			in = new FileInputStream(PropertiesUtil.class.getResource("/").getPath()+"/config.properties");
		
		pro.load(in);
		return pro.getProperty(key);
	   
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			try {
				if(ObjectHelper.isNotEmpty(in)){
				in.close();
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
        return null;
	}
	
	
}
